<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
		<ui:composition template="/admin/template.xhtml">
				<ui:define name="body">
						<style>
.fixcol120 {
	width: 120px;
}
</style>
						<h:form>
								<p:panel id="create-panel" header="病情选择" style="margin-bottom:10px;">
										<p:messages id="create-messages" />
										<h:panelGrid columns="3" cellpadding="5" columnClasses="fixcol120">

												<p:outputLabel for="foodName" value="所属病种" />
												<p:selectOneMenu id="foodName" value="#{illnessCategory.id}" style="width: 300px;" required="true" valueChangeListener="#{kaiFangZiController.onSelectedValueChanged}">
														<f:selectItem itemLabel="请选择" itemValue="-1"></f:selectItem>
														<f:selectItems value="#{kaiFangZiController.illNessCategoryList}" var="icType" itemLabel="#{icType.illnessName}" itemValue="#{icType.id}"></f:selectItems>
														<f:ajax render="subCateName detail_panel"></f:ajax>
												</p:selectOneMenu>
												<h:outputText value="(病种可在病种管理中设定)"></h:outputText>

												<p:outputLabel for="subCateName" value="所属病症" />
												<p:selectOneMenu id="subCateName" value="#{kaiFangZiController.selectedScType}" style="width: 300px;" required="true" valueChangeListener="#{kaiFangZiController.onScValueChanged}">
														<f:selectItem itemLabel="请选择" itemValue="-1"></f:selectItem>
														<f:selectItems value="#{kaiFangZiController.subCategoryList}" var="scType" itemLabel="#{scType.subCateName}" itemValue="#{scType.id}"></f:selectItems>
														<f:ajax render="detail_panel"></f:ajax>
												</p:selectOneMenu>
												<h:outputText value="(病症可在病症管理中设定)"></h:outputText>

										</h:panelGrid>
										<h:panelGrid columns="2" cellpadding="5" columnClasses="fixcol120" id="detail_panel">
												<p:outputLabel value="所属症状" />
												<ui:repeat var="bean" value="#{kaiFangZiController.detailCategoryList}" varStatus="status">
														<p:selectBooleanCheckbox itemLabel="#{bean.detailCateName}" value="#{kaiFangZiController.detailCategoryList[status.index].check}" style="margin-right: 10px;"></p:selectBooleanCheckbox>
												</ui:repeat>
										</h:panelGrid>
										<p:commandButton value="生成方案" actionListener="#{kaiFangZiController.generateSolution}" update="query-panel"></p:commandButton>
								</p:panel>


								<p:panel id="query-panel" header="处方笺" style="margin-bottom:10px;">
										<p>对应病种：#{kaiFangZiController.cateOneName}</p>
										<p>对应病症：#{kaiFangZiController.cateTwoName}</p>
										<p>
												主方：
												<h:outputText value="#{kaiFangZiController.mainSolution}"></h:outputText>
										</p>
									副方：
										<ui:repeat var="bean" value="#{kaiFangZiController.detailCategoryList}" varStatus="status">
												<p>
														<h:outputText value="症状描述：#{bean.detailCateName}" rendered="#{bean.check}"></h:outputText>
														<br />
														<h:outputText value="症状副方：#{bean.detailSolution}" rendered="#{bean.check}"></h:outputText>
												</p>
										</ui:repeat>
								</p:panel>
								<p:commandButton value="打印处方笺" type="button">
										<p:printer target="query-panel" />
								</p:commandButton>
						</h:form>
				</ui:define>
		</ui:composition>
</h:body>
</html>